package com.xmu.prcs.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
 * 属表
 * @author frequent
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "kindshu", uniqueConstraints = @UniqueConstraint(columnNames = "kindname"))
public class KindShu implements Serializable {

	private Integer idKindShu;
	private String kindName;//分类名
	private Date updateTime;//增加的时间
	private Set<Plant> plants;//属下的所有植物
	
	public KindShu(){
		
	}
	
	public KindShu(String kindname){
		this.kindName = kindname;
	}

	@Id
	@GeneratedValue
	@Column(name = "idkindshu", unique = true, nullable = true)
	public Integer getIdKindShu() {
		return idKindShu;
	}

	public void setIdKindShu(Integer idKindShu) {
		this.idKindShu = idKindShu;
	}

	@Column(name = "kindname", length = 10)
	public String getKindName() {
		return kindName;
	}

	public void setKindName(String kindName) {
		this.kindName = kindName;
	}
	
	@Column(name = "updatetime")
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@OneToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "idkindshu")
	public Set<Plant> getPlants() {
		return plants;
	}

	public void setPlants(Set<Plant> plants) {
		this.plants = plants;
	}
	
}
